package cn.schoolwow.util.test.module.query.instanceList.flow.query;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.util.test.module.common.domain.User;

import java.util.ArrayList;
import java.util.List;

public class initialUserListInstanceDataFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        String password = "123456";

        List<User> userList = new ArrayList<>();
        for(int i=0;i<10;i++){
            User user = new User();
            user.username = "username"+i;
            user.password = password;
            user.age = i;
            userList.add(user);
        }
        userList.get(0).age = null;
        flowContext.putTemporaryData("userList", userList);
        flowContext.putTemporaryData("password", password);
    }

    @Override
    public String name() {
        return "初始化用户列表数据";
    }
}
